﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Themes/MasterPage.master" AutoEventWireup="true"
    CodeFile="MounterInfoMaintain.aspx.cs" Inherits="BaseInfoManagement_MounterInfoMaintain" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style>
        .modalPopup
        {
            background-color: #FAD817;
            border-width: 3px;
            border-style: solid;
            border-color: Gray;
            padding: 3px;
            width: 250px;
        }
        .modalBackground
        {
            filter: alpha(opacity=70);
            opacity: 0.7;
        }
    </style>
    <script src="../Themes/Js/checkItem.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript" src="../Themes/MyCalendar/WdatePicker.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="TabTitle" runat="Server">
    <asp:Literal runat="server" ID="title" Text="<%$Resources:Resource,MounterInfoMaintain%>"></asp:Literal>
    <%--贴片机信息管理--%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="Server">
    <div style="width: 100%;">
        <div class="queryDiv1">
            <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="divFrameHead">
                        <span class="querytextCss">
                            <%=Resources.Resource.Query%></span>
                    </td>
                </tr>
                <tr>
                    <td class="submitborder" style="padding-top: 15px; padding-bottom: 15px;">
                        <table style="margin-bottom: 10px;" width="95%" border="0" align="center" cellpadding="0"
                            cellspacing="0">
                            <tr>
                                <td class="submitborder4">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td class="submitFieldbg">
                                                <%= Resources.Resource.Model%><%--型号--%>
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="txtType" runat="server" Width="120px"></asp:TextBox>
                                                &nbsp;
                                            </td>
                                            <td class="submitFieldbg">
                                                <%= Resources.Resource.Ability%><%--能力--%>
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="txtAbilty" runat="server" Width="120px"></asp:TextBox>
                                                &nbsp;
                                            </td>
                                            <td class="submitFieldbg">
                                                <%= Resources.Resource.Parameter%><%--参数--%>&nbsp;
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="txtParameter" runat="server" Width="130px"></asp:TextBox>
                                                &nbsp;
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="submitFieldbg">
                                                <%= Resources.Resource.ModifyTime %><%--修改时间--%>&nbsp;
                                            </td>
                                            <td align="left">
                                                <input type="text" id="txtMaintenanceStartTime" runat="server" class="Wdate" style="width: 120px"
                                                    onfocus="WdatePicker({isShowClear:false,dateFmt:'yyyy-MM-dd'})" />
                                                &nbsp;
                                            </td>
                                            <td class="submitFieldbg"  style="text-align:left;">
                                                至
                                            </td>
                                            <td align="left">
                                                <input type="text" id="txtMaintenanceEndTime" runat="server" class="Wdate" style="width: 120px"
                                                    onfocus="WdatePicker({isShowClear:false,dateFmt:'yyyy-MM-dd'})" />&nbsp;
                                            </td>
                                            <td class="submitFieldbg">
                                                <%= Resources.Resource.Modifier %><%--修改人--%>&nbsp;
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="txtModifyPer" runat="server" Width="130px"></asp:TextBox>&nbsp;
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="submitFieldbg">
                                                <%= Resources.Resource.EffectiveTime%><%--有效时间段--%>&nbsp;
                                            </td>
                                            <td align="left">
                                                <input type="text" id="txtEffectiveTimeStart" runat="server" class="Wdate" style="width: 120px"
                                                    onfocus="WdatePicker({isShowClear:false,dateFmt:'yyyy-MM-dd'})" />&nbsp;
                                            </td>
                                            <td class="submitFieldbg" style="text-align:left;">
                                                至
                                            </td>
                                            <td align="left">
                                                <input type="text" id="txtEffectiveTimeEnd" runat="server" class="Wdate" style="width: 120px"
                                                    onfocus="WdatePicker({isShowClear:false,dateFmt:'yyyy-MM-dd'})" />&nbsp;
                                            </td>
                                            <td class="submitFieldbg">
                                                Version&nbsp;
                                            </td>
                                            <td align="left">
                                                <IMC:PUVersionDropDownList ID="dll_PUVersion" runat="server" Style="width: 135px">
                                                </IMC:PUVersionDropDownList>
                                                &nbsp;
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                        <div style="text-align: center;">
                            <%--查 询--%>
                            <asp:Button ID="btnSearch" runat="server" Text="<%$ Resources:Resource,btnEnquiry %>"
                                OnClick="btnSearch_Click" />
                            &nbsp;&nbsp;
                            <%--新 建--%>
                            <asp:Button ID="btnNew" runat="server" Text="<%$ Resources:Resource,btnNew %>" OnClientClick="return Add()" />
                            <%--版本复制--%>
                            <asp:Button ID="btn_CopyVersion" runat="server" Text="<%$ Resources:Resource,CopyVersion %>"
                                OnClientClick="return CopyVersion()" />
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <div class="GridDivCss">
            <IMC:GridView ID="gvProductionUnitView" runat="server" AllowPaging="true" AllowSorting="true"
                PageSize="10" DataSourceID="ProductionUnitViewDataSource" OnRowCommand="gvProductionUnitView_RowCommand">
                <Columns>
                    <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                        HeaderStyle-Width="15%" ItemStyle-Width="15%" Visible="false">
                        <HeaderTemplate>
                            <asp:CheckBox ID="all" runat="server" onclick="CheckAllItem(this)" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="single" runat="server" onclick="CheckItem(this)" />
                            <input type="hidden" id="hidDiv" value='<%#Eval("PUID")%>,<%#Eval("PUType")%>,<%#Eval("PUCapacity")%>,<%#Eval("Para")%>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources:Resource,Model %>" ItemStyle-HorizontalAlign="Left">
                        <%--型号--%>
                        <ItemTemplate>
                            &nbsp;<asp:Label ID="lbMounterType" runat="server" Text='<%#Eval("PUType")%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources:Resource,Ability %>" ItemStyle-HorizontalAlign="Center">
                        <%--能力--%>
                        <ItemTemplate>
                            &nbsp;<asp:Label ID="lbMounterAbility" runat="server" Text='<%#Eval("PUCapacity")%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources:Resource,Parameter %>" ItemStyle-HorizontalAlign="Center">
                        <%--参数--%>
                        <ItemTemplate>
                            &nbsp;
                            <asp:Label ID="lbMounterParameter" runat="server" Text='<%#Eval("Para")%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField ItemStyle-Width="300px" HeaderText="<%$ Resources:Resource,EffectiveTime %>"
                        ItemStyle-HorizontalAlign="Center">
                        <%--有效时间段--%>
                        <ItemTemplate>
                            &nbsp;
                            <%#ConvertDateType.DateTryFormat(Eval("EffectiveTimeStart"))%>
                            -
                            <%#ConvertDateType.DateTryFormat(Eval("EffectiveTimeEnd"))%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources:Resource,Modifier %>" ItemStyle-HorizontalAlign="Center">
                        <%--修改人--%>
                        <ItemTemplate>
                            &nbsp;
                            <asp:Label ID="lbModifyPer" runat="server" Text='<%#Eval("ModifyPerson")%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources:Resource,ModifyTime %>" ItemStyle-HorizontalAlign="Center">
                        <%--修改时间--%>
                        <ItemTemplate>
                            &nbsp;<asp:Label ID="lbModifyTime" runat="server" Text='<%#ConvertDateType.DateTimeTryFormat(Eval("ModifyDateTime"))%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources:Resource,Operating %>" ItemStyle-HorizontalAlign="Center">
                        <%--操 作--%>
                        <ItemTemplate>
                            <a href="#" onclick="Upd('<%#Eval("PUID")%>','<%#Eval("PUType")%>','<%#Eval("PUCapacity")%>',
                            '<%#Eval("Para")%>','<%#Eval("ModifyPerson")%>','<%#Eval("ModifyDateTime")%>',
                            '<%#ConvertDateType.DateTryFormat(Eval("EffectiveTimeStart"))%>',
                            '<%#ConvertDateType.DateTryFormat(Eval("EffectiveTimeEnd"))%>')">
                                <%= Resources.Resource.btnMaintain %>
                            </a>
                            <%--修改--%>
                            <asp:LinkButton ID="lbtnDel1" runat="server" CommandName="Del" CommandArgument='<%#Eval("PUID")%>'
                                OnClientClick="return isDel()"><%= Resources.Resource.btnDel %></asp:LinkButton>
                            <%--删除--%>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </IMC:GridView>
            <asp:ObjectDataSource ID="ProductionUnitViewDataSource" runat="server" TypeName="ProductionUnitViewDataSource"
                SelectMethod="Select">
                <SelectParameters>
                    <asp:ControlParameter ControlID="txtType" PropertyName="Text" Name="Type" Type="String" />
                    <asp:ControlParameter ControlID="txtAbilty" PropertyName="Text" Name="Abilty" Type="String" />
                    <asp:ControlParameter ControlID="txtModifyPer" PropertyName="Text" Name="ModifyPer"
                        Type="String" />
                    <asp:ControlParameter ControlID="txtMaintenanceStartTime" PropertyName="Value" Name="MaintenanceStartTime"
                        Type="String" />
                    <asp:ControlParameter ControlID="txtMaintenanceEndTime" PropertyName="Value" Name="MaintenanceEndTime"
                        Type="String" />
                    <asp:ControlParameter ControlID="txtEffectiveTimeStart" PropertyName="Value" Name="EffectiveTimeStart"
                        Type="String" />
                    <asp:ControlParameter ControlID="txtEffectiveTimeEnd" PropertyName="Value" Name="EffectiveTimeEnd"
                        Type="String" />
                    <asp:ControlParameter ControlID="dll_PUVersion" PropertyName="Text" Name="PUVersion"
                        Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>
            <asp:HiddenField ID="hidPU" runat="server" />
        </div>
        <div style="text-align: center; padding-top: 10px;">
            <%--确 定--%>
            <input id="btnOK" type="button" class="buttonbgYellow" value="<%$ Resources:Resource,btnOK %>"
                onclick="ConfigPU()" runat="server" visible="false" />
            <input id="btnVendorContactCancel" type="button" class="buttonbgYellow" value="<%$ Resources:Resource,btnClear %>"
                onclick="Closed()" runat="server" visible="false" />
            <%--取 消--%>
        </div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <input id="btnPreview" runat="server" type="button" value="预览" cssclass="buttonbgtwo"
            style="display: none;" />
        <input id="btnCopyVersion" runat="server" type="button" value="复制" cssclass="buttonbgtwo"
            style="display: none;" />
        <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="btnPreview"
            PopupControlID="Panel1" BackgroundCssClass="modalBackground" CancelControlID="btnCancel"
            DropShadow="true" PopupDragHandleControlID="Panel3" />
        <asp:Panel ID="Panel1" runat="server" Width="580px" Style="display: none" CssClass="modalPopup">
            <asp:Panel ID="Panel3" runat="server" Style="cursor: move; background-color: #DDDDDD;
                border: solid 1px Gray; color: Black">
                <div class="tagdivhead" style="background-color: #D6E0EE; padding-top: 8px">
                    <div class="divcenter">
                        <span>&nbsp;<asp:Label ID="lbtitle" runat="server" CssClass="querytextCss" Width="150px"
                            Height="16px"></asp:Label>
                        </span>
                    </div>
                </div>
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ModifytableCss">
                    <tr>
                        <td colspan="6" style="height: 1px">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td class="querytexttdCss">
                            <%=Resources.Resource.Model%><%--型号--%>
                        </td>
                        <td class="querycoltdCss">
                            <asp:TextBox ID="txtType2" runat="server" Width="120px" MaxLength="40"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage=""
                                ControlToValidate="txtType2" Text="*" Display="Dynamic" ValidationGroup="Upd"></asp:RequiredFieldValidator>
                        </td>
                        <td class="querytexttdCss" style="width: 30px">
                            <%=Resources.Resource.Ability%><%--能力--%>
                        </td>
                        <td class="querycoltdCss">
                            <asp:TextBox ID="txtAbility2" runat="server" Width="120px" MaxLength="9"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage=""
                                Display="Dynamic" ControlToValidate="txtAbility2" Text="*" ValidationGroup="Upd"></asp:RequiredFieldValidator>
                            <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="<%$Resources:Resource,Number%>"
                                ControlToValidate="txtAbility2" Type="Double" MinimumValue="0" MaximumValue="99999999"
                                Display="Dynamic" ValidationGroup="Upd">
                            </asp:RangeValidator><%--请填数字--%>
                        </td>
                        <td class="querytexttdCss">
                            <%=Resources.Resource.Parameter%><%--参数--%>
                        </td>
                        <td class="querycoltdCss">
                            <asp:TextBox ID="txtParameter2" runat="server" Width="120px" MaxLength="30"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage=""
                                ControlToValidate="txtParameter2" Text="*" Display="Dynamic" ValidationGroup="Upd"></asp:RequiredFieldValidator>
                            <asp:CompareValidator ID="CompareValidator2" runat="server" ControlToValidate="txtParameter2"
                                ValidationGroup="Upd" ErrorMessage="<%$Resources:Resource,Number%>" Type="Double"
                                Display="Dynamic"></asp:CompareValidator>
                        </td>
                        <%--请填数字--%>
                    </tr>
                    <tr>
                        <td colspan="6" style="height: 1px">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td class="querytexttdCss" style="width: 65px">
                            <%= Resources.Resource.EffectiveTime%><%--有效时间段--%>
                        </td>
                        <td class="querycoltdCss" align="left">
                            <input type="text" id="txtEffectiveTimeStart2" runat="server" class="Wdate" style="width: 120px"
                                onfocus="WdatePicker({isShowClear:false,dateFmt:'yyyy-MM-dd'})" />
                        </td>
                        <td class="querycoltdCss" align="center">
                            --
                        </td>
                        <td class="querycoltdCss" align="left" colspan="3">
                            <input type="text" id="txtEffectiveTimeEnd2" runat="server" class="Wdate" style="width: 120px"
                                onfocus="WdatePicker({isShowClear:false,dateFmt:'yyyy-MM-dd'})" />
                            &nbsp;<asp:HiddenField runat="server" ID="hidMounterID" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6" style="height: 1px">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6" style="padding-bottom: 3; padding-top: 3">
                            <%--保 存--%>
                            <asp:Button ID="btnAdd" runat="server" Text="<%$Resources:Resource,btnSave%>" OnClick="btnAdd_Click"
                                ValidationGroup="Upd" />
                            &nbsp;&nbsp;
                            <%--保 存--%>
                            <asp:Button ID="btnUpd" runat="server" Text="<%$Resources:Resource,btnSave%>" OnClick="btnUpd_Click"
                                ValidationGroup="Upd" />
                            &nbsp;&nbsp;
                            <%--取 消--%>
                            <asp:Button ID="btnCancel" runat="server" Text="<%$Resources:Resource,btnClear%>" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6" style="height: 1px">
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </asp:Panel>
        <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnCopyVersion"
            PopupControlID="Panel2" BackgroundCssClass="modalBackground" CancelControlID="btn_CancelCopy"
            DropShadow="true" PopupDragHandleControlID="Panel4" />
        <asp:Panel ID="Panel2" runat="server" Width="580px" Style="display: none" CssClass="modalPopup">
            <asp:Panel ID="Panel4" runat="server" Style="cursor: move; background-color: #DDDDDD;
                border: solid 1px Gray; color: Black">
                <div class="tagdivhead" style="background-color: #D6E0EE; padding-top: 8px">
                    <div class="divcenter">
                        <span>&nbsp;<asp:Label ID="Label1" runat="server" CssClass="querytextCss" Width="150px"
                            Height="16px"></asp:Label>
                        </span>
                    </div>
                </div>
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ModifytableCss">
                    <tr>
                        <td colspan="6" style="height: 1px">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6" style="text-align: center">
                            <%=Resources.Resource.VersionRemark%><%--版本备注--%>
                            <asp:TextBox ID="txt_VersionRemark" runat="server" Width="300px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6" style="padding-bottom: 3; padding-top: 3">
                            <%--保 存--%>
                            <asp:Button ID="btn_SaveCopy" runat="server" Text="<%$Resources:Resource,btnSave%>"
                                OnClick="btn_SaveCopy_Click" />
                            &nbsp;&nbsp;
                            <%--取 消--%>
                            <asp:Button ID="btn_CancelCopy" runat="server" Text="<%$Resources:Resource,btnClear%>" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6" style="height: 1px">
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </asp:Panel>
    </div>
    <script type="text/javascript">
        function Add() {
            document.getElementById("<%= lbtitle.ClientID%>").innerHTML = "<%=Resources.Resource.MounterInfoAdd %>";  //贴片机信息添加
            document.getElementById("<%= txtType2.ClientID%>").value = "";
            document.getElementById("<%= txtAbility2.ClientID%>").value = "";
            document.getElementById("<%= txtParameter2.ClientID%>").value = "";
            document.getElementById('<%= btnUpd.ClientID%>').style.display = "none";
            document.getElementById('<%= btnAdd.ClientID%>').style.display = "";
            document.getElementById("<%= txtEffectiveTimeStart2.ClientID%>").value = "";
            document.getElementById("<%= txtEffectiveTimeEnd2.ClientID%>").value = "";
            document.getElementById('<%= btnPreview.ClientID%>').click();
            return false;
        }


        function Upd(MounterID, Type, Ability, Parameter, ModifyPer, ModifyTime, EffectiveTimeStart, EffectiveTimeEnd) {
            document.getElementById("<%= lbtitle.ClientID%>").innerHTML = "<%=Resources.Resource.MounterInfoMangement %>"; //"贴片机信息维护";
            document.getElementById("<%= hidMounterID.ClientID%>").value = MounterID;
            document.getElementById("<%= txtType2.ClientID%>").value = Type;
            document.getElementById("<%= txtAbility2.ClientID%>").value = Ability;
            document.getElementById("<%= txtParameter2.ClientID%>").value = Parameter;
            document.getElementById('<%= btnUpd.ClientID%>').style.display = "";
            document.getElementById('<%= btnAdd.ClientID%>').style.display = "none";
            document.getElementById("<%= txtEffectiveTimeStart2.ClientID%>").value = EffectiveTimeStart;
            document.getElementById("<%= txtEffectiveTimeEnd2.ClientID%>").value = EffectiveTimeEnd;

            document.getElementById('<%= btnPreview.ClientID%>').click();

        }

        function CopyVersion() {
            document.getElementById('<%= btnCopyVersion.ClientID%>').click();
            return false;
        }
        
    </script>
    <script>
        function CheckAllItem(oChcek) {
            CheckAll(oChcek, '<%= gvProductionUnitView.ClientID %>', '<%= hidPU.ClientID %>');
        }

        function CheckItem(oChcek) {
            CheckItemCB(oChcek, '<%= gvProductionUnitView.ClientID %>', '<%= hidPU.ClientID %>');
        }
        function ConfigPU() {
            var retval = document.getElementById('<%= hidPU.ClientID %>').value;

            window.returnValue = retval;
            Closed();
        }
        function Closed() {
            window.opener = null;
            window.close();
        }

        function isDel() {
            return confirm('<%=Resources.Resource.IsDelete %>');
        }
    </script>
</asp:Content>
